package com.cwm.test.single.lazy;

public class Lazysimplesingletion {

    // 加volatile是为了避免指令重排序的问题，可见性问题
    private volatile static Lazysimplesingletion instance;

    private Lazysimplesingletion() {
    }

    /**
     * 出现同步并发问题
     * @return
     */
    public static Lazysimplesingletion getInstance() {
        if (instance == null) {
            instance = new Lazysimplesingletion();
        }
        return instance;
    }
}